package com.aplink.generic.pojo.controlspec;

import com.aplink.generic.constant.ControlType;
import com.aplink.generic.util.objectrule.ObjectBaseRule;

public class ControlSpec {
    private String mControlId;
    private ControlType mControlType;
    private boolean isVisibility;
    private ObjectBaseRule mObjectBaseRule;
    private String mValue;
    private String mValidationGroup;
    private String mMappingName;
    private String mDataObject;

    /**
     * The table column name.<br/>
     * This property mapping for "mappingname" attribute.<br/>
     * Example: mappingname="ShopName"
     *
     * @return MappingName
     */
    public String getMappingName() {
        return mMappingName;
    }

    /**
     * The property or the table column name.<br/>
     * This property mapping for "mappingname" attribute.<br/>
     * Example: mappingname="ShopName"
     *
     * @param mappingName
     */
    public void setMappingName( String mappingName ) {
        mMappingName = mappingName;
    }

    /**
     * Data table name.<br/>
     * This property mapping for "dataobj" attribute.<br/>
     * Example: dataobj="ShopTable"
     *
     * @param mDataObject
     */
    public String getDataObject() {
        return mDataObject;
    }

    /**
     * Data table name.<br/>
     * This property mapping for "dataobj" attribute.<br/>
     * Example: dataobj="ShopTable"
     *
     * @param dataObject
     */
    public void setDataObject( String dataObject ) {
        mDataObject = dataObject;
    }

    /**
     * The ID by String of control.<br/>
     * This property mapping for "id" attribute.<br/>
     * Example: id="txt_shop_name"
     *
     * @return ControlId by String
     */
    public String getControlId() {
        return mControlId;
    }

    /**
     * The ID by String of control.<br/>
     * This property mapping for "id" attribute.<br/>
     * Example: id="txt_shop_name"
     *
     * @param controlId
     */
    public void setControlId( String controlId ) {
        mControlId = controlId;
    }

    /**
     * The type of this control.<br/>
     * This property mapping for "ctltype" attribute.<br/>
     * Example: ctltype="textbox"
     *
     * @return
     */
    public ControlType getControlType() {
        return mControlType;
    }

    /**
     * The type of this control.<br/>
     * This property mapping for "ctltype" attribute.<br/>
     * Example: ctltype="textbox"
     *
     * @param controlType
     */
    public void setControlType( ControlType controlType ) {
        mControlType = controlType;
    }

    /**
     * The type of this control.<br/>
     * This property mapping for "ctltype" attribute.<br/>
     * Example: ctltype="textbox"
     *
     * @param controlType
     */
    public void setControlType( String controlType ) {
        mControlType = ControlType.get( controlType );
    }

    /**
     * The rule to allow the visibility of control.<br/>
     * This property mapping for "visibility" attribute.<br/>
     * Example: visibility="N"
     *
     * @return
     */
    public boolean isVisibility() {
        return isVisibility;
    }

    /**
     * The rule to allow the visibility of control.<br/>
     * This property mapping for "visibility" attribute.<br/>
     * Example: visibility="N"
     *
     * @param visibility
     */
    public void setVisibility( boolean visibility ) {
        isVisibility = visibility;
    }

    /**
     * the value of control. <br/>
     * With button, this value use for button text.<br/>
     * Example: value="Submit"
     *
     * @return
     */
    public String getValue() {
        return mValue;
    }

    /**
     * the value of control. <br/>
     * With button, this value use for button text.<br/>
     * Example: value="Submit"
     *
     * @param text
     */
    public void setValue( String text ) {
        mValue = text;
    }

    /**
     * The String value to validate group of control.<br/>
     * This property mapping for "validationgroup" element.<br/>
     * Example: <validationgroup>Submit</validationgroup>
     *
     * @return
     */
    public String getValidationGroup() {
        return mValidationGroup;
    }

    /**
     * The String value to validate group of control.<br/>
     * This property mapping for "validationgroup" element.<br/>
     * Example: <validationgroup>Submit</validationgroup>
     *
     * @param validationGroup
     */
    public void setValidationGroup( String validationGroup ) {
        mValidationGroup = validationGroup;
    }

    public ObjectBaseRule getObjectBaseRule() {
        return mObjectBaseRule;
    }

    public void setObjectBaseRule( ObjectBaseRule objectBaseRule ) {
        mObjectBaseRule = objectBaseRule;
    }

    public boolean hasBaseRule() {
        return this.mObjectBaseRule != null;
    }
}
